package com.example.router

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.DegradeService
import com.example.base.path.RouterPath

/**
 * 全局降级策略(处理路由跳转中找不到的场景)
 */
@Route(path = RouterPath.PATH_GLOBAL_DEGRADE)
class GlobalDegradeService :DegradeService{
    private lateinit var mContent:Context
    override fun init(context: Context?) {
        context?.let {
            mContent=it
        }
    }

    override fun onLost(context: Context?, postcard: Postcard?) {
        postcard?.group=RouterPath.GROUP_EMPTY
        postcard?.path=RouterPath.PATH_EMPTY_PAGE
        postcard?.navigation()
    }
}